<?php

use think\migration\Seeder;

class WeekTableSeeder extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $rows = [];
        $j = 1;
        for($i = 1; $i <= 12; $i ++){
            if($i > 8 ){
                $j = 3;
            }else if($i > 4){
                $j = 2;
            }
            $rows[] =  [
                'stage_id' => $i,
                'title' => 'HTML5基础语法与标签' . $j . '阶段',
                'user_id' => 1,
                'week_name' => 1,
                'sort' => 1,
                'create_time' => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
            ];

            $rows[] = [
                'stage_id' => $i,
                'title' => 'CSS3基础语法与盒模型' . $j . '阶段',
                'user_id' => 1,
                'week_name' => 2,
                'sort' => 2,
                'create_time' => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
            ];
            $rows[] = [
                'stage_id' => $i,
                'title' => 'CSS3浮动定位与背景样式' . $j . '阶段',
                'user_id' => 1,
                'week_name' => 3,
                'sort' => 3,
                'create_time' => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
            ];
            $rows[] = [
                'stage_id' => $i,
                'title' => 'CSS3动画与穷游首页开发' . $j . '阶段',
                'user_id' => 1,
                'week_name' => 4,
                'sort' => 4,
                'create_time' => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
            ];
            $rows[] = [
                'stage_id' => $i,
                'title' => 'Js基础语法与Jquery学习' . $j . '阶段',
                'user_id' => 1,
                'week_name' => 5,
                'sort' => 5,
                'create_time' => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
            ];
        }
        
        $this->table('week')->insert($rows)->save();
    }
}